home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_02_10 / 2n10067a < prev    next >
Text File  |  1991-07-15  |  1KB  |  46 lines

  1. /* -------------------------------------------------------
  2.                          LISTING 2
  3.     File:  testbrk.c
  4.  
  5.     This is the test driver for the routines in
  6.     breakout.asm.
  7.  
  8.     Author:  David Burki
  9.    ------------------------------------------------------- */
  10. #include <stdio.h>
  11.  
  12.  
  13. // define far a pointer to a void function
  14. typedef void (far *PFV)();
  15.  
  16. // function prototypes
  17. void insure(PFV);
  18. void interrupt far pre_termination(void);
  19. void cancel(void);
  20.  
  21.  
  22. /* -------------------------------------------------------
  23.    function which performs any necessary clean-up before
  24.    terminating the application
  25.    ------------------------------------------------------- */
  26. void interrupt far pre_termination()
  27. {
  28.   printf("\nIn the pre-termination function\npress any key\n");
  29.   getch();
  30.   exit(1);
  31. }
  32.  
  33. // test driver main function
  34. main()
  35. {
  36. // register the cancel function so exit will call it
  37.   atexit(cancel);
  38.  
  39. // install the breakout tool
  40.   insure((PFV)pre_termination);
  41.  
  42. // a never ending loop
  43.   for(;;)
  44.      ;
  45. }
  46.